package com.zxy.controller;

import com.zxy.model.IoItem;
import com.zxy.model.IoItemQuery;
import com.zxy.model.IoMaster;
import com.zxy.model.IoMasterQuery;
import com.zxy.service.IoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/io") //restFul
public class IoController {

    @Autowired
    private IoService ioService;

    @PostMapping
    public int insert(@RequestBody IoMaster master) {
        return ioService.insert(master);
    }
//    @PostMapping("/test")
//    public int insert2(@RequestBody IoItem master) {
//        return 1;
//    }

    @GetMapping
    public List<IoMaster> select(IoMasterQuery query) {
        return ioService.select(query);
    }

    @GetMapping("/item")
    public List<IoItem> select(IoItemQuery query) {
        return ioService.selectItem(query);
    }


//    {
//        "poId":"P020230817160340141",
//        "brief":"入库说明",
//        "items":[{
//            "productId":1,
//            "productName":"测试",
//            "shelfId":12,
//            "qty":8,
//            "brief":"备注",
//            "poItemId":7,
//            "productionDate":"2023-08-22",
//            "expirationDay":30
//        }
//    }
}